<!-- script/PETools/Aries/ObjectInstancesEditor.html -->
<!-- Author: LiXizhi 
Date:2010.9.18
-->
<pe:mcml>
<script type="text/npl" src="ObjectInstancesEditor.lua">
ObjectInstancesEditor = commonlib.gettable("MyCompany.PETools.Editors.ObjectInstancesEditor");
ObjectInstancesEditor.Init()
</script>
<div style="margin:5px;width:250px;">
<form name="PEToolsObjInstancesEditorForm">
    <div>实例数据: <%=format("%s [%d]个", (ObjectInstancesEditor.name or ""), #(ObjectInstancesEditor.GetDataSource()))%></div>
    <Resource style="display:none" name="SampleDataSource">
        <instance index="1" position="0,0,0" facing="0" scaling="1" >
            <goto /><set_current /><view/>
        </instance>
        <instance index="2" position="2,2,2" facing="2" scaling="2" >
            <goto /><set_current /><view/>
        </instance>
    </Resource>
    <pe:treeview name="tvwObjInstances" DataSource='<%=ObjectInstancesEditor.GetDataSource()%>' DefaultNodeHeight = "26" style="height:300px">
        <NodeTemplates>
		    <NodeTemplate DataType="instance">
                <pe:treenode OnClick="ObjectInstancesEditor.OnClickInstance" can_select="true" text='<%=format("[%s] pos{%s}", tostring(XPath("this|index")),  XPath("this|position") or "")%>' tooltip='<%=format("pos{%s}, facing:%s, scaling:%s", XPath("this|position") or "", XPath("this|facing") or "", XPath("this|scaling") or "")%>'></pe:treenode>
            </NodeTemplate>
            <NodeTemplate DataType="goto">
                <pe:treenode indent="20" icon="Texture/3DMapSystem/common/world_go.png" text="传送到这个位置" OnClick="ObjectInstancesEditor.GotoNode"></pe:treenode>
            </NodeTemplate>
            <NodeTemplate DataType="set_current">
                <pe:treenode indent="20" icon="Texture/3DMapSystem/common/wand.png" text="使用当前人物位置" OnClick="ObjectInstancesEditor.UserCurrentPosition"></pe:treenode>
            </NodeTemplate>
            <NodeTemplate DataType="view">
                <div style="margin:3px;margin-left:25px;">
                    位置: <input type="text" style="width:110px;margin-right:10px" value='<%=XPath("this|position")%>'/><br />
                    方向: <input type="text" style="width:30px;margin-right:10px" value='<%=XPath("this|facing")%>'/>
                    放缩: <input type="text" style="width:30px;" value='<%=XPath("this|scaling")%>'/>
                </div>
            </NodeTemplate>
        </NodeTemplates>
	    <DataNodePlaceholder xpath="*"/>
    </pe:treeview>
    <input type="button" name="AddInstance" value="添加实例" onclick="ObjectInstancesEditor.AddInstance"/>
    <input type="button" style="margin-left:5px;" name="RemoveInstance" value="删除实例" onclick="ObjectInstancesEditor.RemoveInstance"/>
</form>
</div>
</pe:mcml>
